package com.dxq.test.db;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;

/**
 * Author: zsh
 * Date: 2023/10/18
 * Describe: 饲料表（字段）
 */
@DatabaseTable(tableName = "Food")
public class Food implements Serializable {

    public final static String ID_FIELD_NAME = "food_id";

    // id = true:表明这个字段是这条记录的唯一标志符, generatedId = true:表明自动增加的ID
    //序号
    @DatabaseField(generatedId = true, columnName = ID_FIELD_NAME)
    private int food_id;

    //饲料编码
    @DatabaseField(columnName = "code")
    private String code;

    //饲料名称
    @DatabaseField(columnName = "name")
    private String name;

    //饲料配比
    @DatabaseField(columnName = "info")
    private String info;

    //记录时间
    @DatabaseField(columnName = "time")
    private String time;

    //所属牧场  牧场--外键
    @DatabaseField(columnName = "pasture_id", foreign = true, foreignAutoRefresh = true, foreignAutoCreate = true)
    private Pasture pasture_id;//序号

    public Food() {
    }

    public Food(String code, String name, String info, String time, Pasture pasture_id) {
        this.code = code;
        this.name = name;
        this.info = info;
        this.time = time;
        this.pasture_id = pasture_id;
    }

    public int getFood_id() {
        return food_id;
    }

    public void setFood_id(int food_id) {
        this.food_id = food_id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public Pasture getPasture_id() {
        return pasture_id;
    }

    public void setPasture_id(Pasture pasture_id) {
        this.pasture_id = pasture_id;
    }

    @Override
    public String toString() {
        return "Food{" +
                "food_id=" + food_id +
                ", code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", info='" + info + '\'' +
                ", time='" + time + '\'' +
                ", pasture_id=" + pasture_id +
                '}';
    }
}
